客户端下拉刷新后,刷新结果未返回顶部

chengzhenyu 8 years ago
parent
commit
738a3d91a4
1 changed files with 5 additions and 1 deletions
  1. 5 1
      app/src/main/java/ai/pai/client/adapter/RecentPhotoStaggeredAdapter.java

+ 5 - 1
app/src/main/java/ai/pai/client/adapter/RecentPhotoStaggeredAdapter.java

@@ -50,7 +50,11 @@ public class RecentPhotoStaggeredAdapter extends RecyclerView.Adapter<RecentPhot
50 50
     public synchronized void addPhotoList(ArrayList<GroupPhotoItem> photoList){
51 51
         int startPosition = this.photoList.size();
52 52
         this.photoList.addAll(photoList);
53
-        notifyItemRangeInserted(startPosition,photoList.size());
53
+        if(startPosition==0){
54
+            notifyDataSetChanged();
55
+        }else{
56
+            notifyItemRangeInserted(startPosition,photoList.size());
57
+        }
54 58
     }
55 59
 
56 60
     public ArrayList<GroupPhotoItem> getPhotoList(){